//
// Created by wkm on 2024-03-31.
//

#ifndef CHIPBUS_DISPLAY_TOOLS_H
#define CHIPBUS_DISPLAY_TOOLS_H

#include <cstdio>
#include <cstdarg>
#include <cerrno>

char transfer_status_str[4][30] = {
        "Transfer Ok!", "Transfer Error",
        "Transfer wait", "Address out of range"
};

int sb_fprintf(FILE *fp, const char *fmt, ...) {
    va_list ap;
    va_start(ap, fmt);
    int ret = 0;
    do {
        errno = 0;
        ret = vfprintf(fp, fmt, ap);
    } while (errno == EINTR);
    return ret;
}

#endif //CHIPBUS_DISPLAY_TOOLS_H
